/*
 * JSF Toolkit Component Framework
 * Copyright (C) 2007 Noah Sloan <iamnoah A-T gmail D0T com>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 */
package com.jsftoolkit.gen.writer.impl;

import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Set;

import org.xml.sax.SAXException;

import com.jsftoolkit.base.ResourceInfo;
import com.jsftoolkit.base.renderer.HtmlRenderer;
import com.jsftoolkit.gen.writer.ClassWriterWrapper;
import com.jsftoolkit.gen.writer.RendererWriter;
import com.jsftoolkit.utils.Utils;

public class RendererWriterImpl extends ClassWriterWrapper implements
		RendererWriter {

	public RendererWriterImpl() {
		super();
	}

	public RendererWriterImpl(PrintStream out) {
		setWriter(new BasicClassWriter(out));
	}

	@Override
	@SuppressWarnings("unchecked")
	public void printImports(Set<Class<?>> imports) {
		imports.addAll(Arrays.asList(IOException.class, SAXException.class,
				Set.class, ResourceInfo.class,
				HtmlRenderer.class, Utils.class));

		super.printImports(imports);
	}

	public void printRendersChildren(boolean rendersChildren) {
		startMethod(Modifier.PUBLIC, boolean.class, "getRendersChildren", null);
		indent().printf("return %b;", rendersChildren).endBlock();
	}

}
